import React, {Component} from 'react';
import {Image, Text, TouchableOpacity,} from 'react-native';
import {homefiveStyle as styles} from '../../../../styles';
import {common_url} from "../../../util/fetch";

let Dimensions = require('Dimensions');
let width = Dimensions.get('window').width;

export default class Homefive_1 extends Component {
    // 初始化模拟数据
    constructor(props) {
        super(props);
    }

    //list子项加载方法
    render() {
        if (this.props.postion !== undefined) {
            return (
                <TouchableOpacity
                    onPress={() => {
                        this.goGet('Postionin', this.props.postion.postionId);
                    }}
                    activeOpacity={1}
                    style={[styles.foureveryall, {width: width * 0.27}]}>
                    <Image source={
                        this.props.postion.company.companyPicture ?
                            {uri: common_url + "uploadImg/" + this.props.postion.company.companyPicture}
                            : require('../../../img/app/company.png')} style={styles.head}/>
                    <Text style={styles.fivename}>{this.props.postion.postionName}</Text>
                    <Text style={styles.fivecom}>{this.props.postion.company.companyName}</Text>
                </TouchableOpacity>
            )
        } else {
            return null;
        }
    }

    goGet(name, id) {
        this.props.navigation.navigate(name, {useId: id});
    }

}